<?php

require("/srv/http/scrap/conf.php");
require_once($srvpath.'data/dbase.php');

function InsTbl($params) {
	#echo 'nyuu';
	#if (!$params) echo ':o';
	$conn_handler=$GLOBALS['conn_handler'];
	#if (!$conn_handler) echo 'fpalm';
	#else echo 'OK';

	$table=$params['table'];
	$info_field=$params['field'];
	$info_value=$params['value'];
	$operation=$params['operation'];
	#echo $operation;
	//$qry='insert into '.$table.' (info_field, info_value) values ('.$info_field.', '.$info_value');';
	if ($operation=='insert') {
		$qry='insert into '.$table.' (info_field, info_value) values ("'.$info_field.'", "'.$info_value.'");';
		mysql_query($qry, $conn_handler);
	}
	else if ($operation=='update') {
		$qry='update '.$table.' set '.$info_field.'='.$info_value.' where info_field="'.$info_field.'";';
		mysql_query($qry, $conn_handler);
	}
	else if ($operation=='load') {
		#echo 'nooo';
		$qry='select * from '.$table.' where info_field="'.$info_field.'";';
		#echo $qry;
		$qret=mysql_query($qry, $conn_handler);
		if (!$qret) echo 'KARA';
		$res=mysql_fetch_array($qret);
		$nos['info_field']=$res[0];
		#echo $nos['info_field'];
		$nos['info_value']=$res[1];
		$nos['table']=$table;
		#echo $nos['info_value'];
#		}
		#echo $res[0];
		return $nos;
	}
	
	

}

?>
